package com.neuedu.autosale.cli.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.autosale.cli.entity.Resale;
import com.neuedu.autosale.cli.service.ResaleService;
import com.neuedu.autosale.entity.Pager;
import com.neuedu.autosale.entity.Result;
import com.neuedu.autosale.mapper.ResaleMapper;

@Service
@Transactional
public class ResaleServiceImpl implements ResaleService {
	@Autowired
	private ResaleMapper resaleMapper;
	
	@Override
	public List<Resale> findListByPager(Pager<Resale> pager){
		return resaleMapper.findListBypager(pager);
	}
	
	@Override
	public Integer findTotalByPager(Pager<Resale> pager) {
		return resaleMapper.findTotalByPager(pager);
	}
	
	@Override
	public Result add(Resale object) {
		Result result =new Result(false,"新增失败！");
		boolean ret=resaleMapper.add(object);
		if(ret) {
			result=new Result(true,"新增成功！");
		}
		return result;
	}
	
	@Override
	public Result edit(Resale object) {
		Result result=new Result(false,"修改失败！");
		boolean ret=resaleMapper.edit(object);
		if(ret) {
			result=new Result(true,"修改成功！");
		}
		return result;
	}
	
	@Override
	public Result deleteByIds(List<Resale> ids) {
		Result result=new Result(false,"删除失败！");
		boolean ret=resaleMapper.deleteByIds(ids);
		if(ret) {
			result=new Result(true,"删除成功！");
		}
		return result;
	}
	
	@Override
	public List<Resale> findAll(){
		return resaleMapper.findAll();
	}
	
	

}
